import React from 'react';
// import { Result } from 'antd';
import { InterviewBoxPc } from '@/pages/RecruitEmail/pc/components';
import initPic from '@/pages/RecruitEmail/images/interview-bg-register.png';
// import AcceptPage from './AcceptPage';
import { RecruitContext } from '@/pages/RecruitEmail/Context';
import RejectPage from './RejectPage';
import ConfirmPage from './ConfirmPage';
import ConfirmReject from './ConfirmReject';
import styles from './index.less';

export default function InterviewOffer({ nid, id }) {
    const [status, setStatus] = React.useState(undefined);
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    const [companyName, setCompanyName] = React.useState('');
    // const [offerEffectiveValue, setOfferEffectiveValue] = React.useState(48);
    const [data, setData] = React.useState(null);
    // const { query } = location;
    // const { action } = query;
    // const expirePage = <Result status="error" title={`超过${offerEffectiveValue}小时未确认，链接已失效！`} />;
    // const isDetailPage = action === 'detail';
    const [title, setTitle] = React.useState('');
    const [content, setContent] = React.useState('');

    const [titleIcon, setTitleIcon] = React.useState(null);

    const context = React.useContext(RecruitContext);
    const { setEntryStatus } = context;
    // const title = <div className={styles.docTitle}>{`欢迎加入${companyName || ''}，请确认您的录用信息`}</div>;

    // if (isDetailPage) {
    //     return (
    //         <div className={styles.hireConfirmWrap}>
    //             {title}
    //             <ConfirmPage
    //                 setCompanyName={setCompanyName}
    //                 setStatus={setStatus}
    //                 setOfferEffectiveValue={setOfferEffectiveValue}
    //                 location={location}
    //                 isDetailPage
    //             />
    //         </div>
    //     );
    // }
    React.useEffect(() => {
        switch (status) {
            case 'accept':
                setEntryStatus('entry');
                // c c();
                // setTitle('请确认您的面试安排并及时接受邀请');
                // setContent('以免错失本次面试机会');
                // setTitleIcon(null);
                break;
            case 'confirmReject':
                // setTitleIcon('check-circle');
                // setTitle('已接受面试');
                // setContent('请尽快填写《应聘登记表》');
                break;
            case 'reject':
                setTitleIcon('shixiao');
                setTitle('已拒绝录用');
                setContent('期待今后我们能有更多故事');
                break;
            case 'init':
                setTitle('请确认您的录用信息并及时接受');
                setContent('以免错失本次录用机会');
                setTitleIcon(null);
                break;
            default:
                break;
        }
    }, [status]);
    // if (status === 'expire') {
    //     return expirePage;
    // }
    return (
        <InterviewBoxPc
            titleProps={{
                src: initPic,
                // titleAfter: companyName,
                title,
                content,
                iconType: titleIcon,
                iconStyle: { color: '#BCC1CD', marginRight: 12 },
                picStyle: { marginBottom: 16, marginLeft: 84, marginTop: 16 }
            }}
            // showTip={!!status}
            // show={status === STATUS.ACCEPT && data?.registerStatus !== 1}
            // onClick={handleCheck}
        >
            {(status === 'init' || status === undefined) && (
                <div className={styles.hireConfirmWrap}>
                    {/* {title} */}

                    <ConfirmPage
                        setCompanyName={setCompanyName}
                        setStatus={setStatus}
                        setData={setData}
                        // setOfferEffectiveValue={setOfferEffectiveValue}
                        nid={nid}
                        id={id}
                    />
                </div>
            )}
            {/* {status === 'accept' && <AcceptPage data={data} />} */}
            {status === 'confirmReject' && (
                <ConfirmReject setCompanyName={setCompanyName} id={nid} setStatus={setStatus} />
            )}
            {status === 'reject' && <RejectPage data={data} />}
        </InterviewBoxPc>
    );
}
